commands: fix a mypy failure in the ctdb commands module #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems that a recent mypy release is now determining that certain family types (not AF_INET, or AF_INET6) may return an address tupe with the first element type being an int rather than a str. The (expanded) revealed type is:
This change ensures that we only check the family values we care about and use a type assertion for those families where we expect the address value to be a str.
FWIW I could not find any documentation for what families have an integer in the first element of the addr tuple. Looking at the python sources it seems like it could be AF_NETLINK, AF_QIPCRTR, AF_VSOCK - all families I have never seen in the wild before :-)